# include "words.h"

/* FILE
 * 
 * file: words.cpp
 * 
 * 
 */
/* 
 */

/* INFO del (WithSelect _)
 * 
 * remove the preselected item - from the selected point (select) 
 * 
 * return: void
 * 
 * 
 */
void 
words__del (struct Words *this)
{
  /* IF this->select->prev is not NULL */
  if (this->select->previous != NULL)
    {
      this->select->previous->next = this->select->next;
    }
  else /*  */
    {
      /* this->select->next will be first */
      this->head = this->select->next;
    }
  
  /* IF this->select->next is not NULL */
  if (this->select->next != NULL)
    {
      this->select->next->previous = this->select->previous;
    }
  else /* else IF this->select->next is NULL */
    {
      /* this->select->prev will be last */
      this->tail = this->select->previous;
    }

  clear__str (this->select->value);
  
  delete this->select;
}

void
clear__str (char *value)
{
  
}

struct Word*
words__get(struct Words *this)
{
  return this->select;
}

/* INFO del (WithTail _)
 * 
 * remove the last element - from the tail part (tail)
 * 
 * return: this->tail element
 * 
 * 
 */
void 
del__tail (struct Words *this)
{
  this->tail->previous->next = NULL;

  this->tail->value->clear ();

  remove = this->tail;
  
  this->tail = this->tail->previous; 

  delete remove;
}


/* INFO del (WithHead _)
 * 
 * remove the first element - from the head part (head)
 * 
 * return: this->head element
 * 
 * 
 */
void 
del__head (struct Words *this)
{
  this->head->next->previous = NULL;

  this->head->value->clear ();
  
  Word* remove = this->head;
  
  this->head = this->head->next; 

  delete remove;
}

